// ignore_for_file: file_names, must_be_immutable, constant_identifier_names, slash_for_doc_comments, avoid_unnecessary_containers, prefer_const_constructors, unnecessary_cast, sized_box_for_whitespace, prefer_function_declarations_over_variables, overridden_fields, annotate_overrides, prefer_const_literals_to_create_immutables, unnecessary_null_comparison, deprecated_member_use

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:yc_plugin_learn/base/config/DeaultPageConfig.dart';

final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();

/**页面状态 */
enum FFPageStatus {
  firstLoading, //首次进入
  noData, //空数据
  netError, //网络错误
  result, //结果页
}

/**抽象类 */
abstract class IFFScaffold {
  /**页面样式 */
  FFScaffoldStyle? ffStyle;
  /**页面状态 */
  FFPageStatus? ffPageStatus;
  /**生命周期方法 */
  void ffInitState();
  void ffDidChangeDependencies();
  void ffDispose();
  /**生命周期方法END */

  /**导航栏 */
  Widget? ffNavi(BuildContext context);
  /**body */
  Widget? ffBody(BuildContext context);
  /**底部 */
  Widget? ffBottom(BuildContext context);

  /**首次进入加载页面 */
  Widget? ffFirstLoadingWidget(BuildContext context);
  /**空数据页面 */
  Widget? ffNoDataWidget(BuildContext context);
  /**网络错误页面 */
  Widget? ffNetErrorWidget(BuildContext context);
}


/**默认实现页 */
class MFFScaffold implements IFFScaffold {
  @override
  Widget? ffNavi(BuildContext context) {}

  @override
  Widget? ffBody(BuildContext context) {}
  @override
  Widget? ffBottom(BuildContext context) {}

  @override
  void ffInitState() {}
  @override
  void ffDidChangeDependencies() {}
  @override
  void ffDispose() {}

  @override
  FFScaffoldStyle? ffStyle = FFScaffoldStyle(
    ffStatusBackgroundColor: Colors.white,
    ffStatusTextColor: SystemUiOverlayStyle.dark,
    ffBodyColor: Colors.white,
  );

  @override
  FFPageStatus? ffPageStatus = FFPageStatus.firstLoading;
  @override
  Widget? ffFirstLoadingWidget(BuildContext context) {
    return DeaultPageConfig.ffFirstLoadingWidget(context);
  }

  @override
  Widget? ffNetErrorWidget(BuildContext context) {
    return DeaultPageConfig.ffNetErrorWidget(context);
  }

  @override
  Widget? ffNoDataWidget(BuildContext context) {
    return DeaultPageConfig.ffNoDataWidget(context);
  }
}

/**页面样式 */
class FFScaffoldStyle {
  /**
   * 状态栏背景颜色，
   * 默认白色,
   * 导航栏没有设置颜色，则会跟随此颜色
   */
  Color? ffStatusBackgroundColor;
  /**状态栏文字颜色，默认黑色 */
  SystemUiOverlayStyle? ffStatusTextColor;
  /**body,默认白色 */
  Color? ffBodyColor;
  /**显示状态栏,默认true:显示 */
  //bool? ffShowStatus;

  FFScaffoldStyle({
    this.ffBodyColor,
    this.ffStatusBackgroundColor,
    this.ffStatusTextColor,
    //this.ffShowStatus,
  });
}
